package org.example.service;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.example.entity.User;
import org.example.mapper.UserMapper;
import org.springframework.data.redis.core.ReactiveRedisTemplate;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

/**
 * TODO 类功能介绍及重点或容易混淆点的说明。
 *
 * @version 1.0 2023/5/20 10:17 龙小南 新建类[说明]
 * @author: 龙小南
 * @Date: 2023/5/20 10:17
 * @Version 1.0[当前版本号]
 */

@Service
public class UserService {

    private final ReactiveRedisTemplate<String, String> redisTemplate;

    private final UserMapper userMapper;

    public UserService(ReactiveRedisTemplate<String, String> redisTemplate, UserMapper userMapper) {
        this.redisTemplate = redisTemplate;
        this.userMapper = userMapper;
    }

    public User createUser(User user) {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        userMapper.insert(user);
        return user;
    }

}
